from selenium import webdriver
import time
from selenium.webdriver.common.by import By
class lago_webauto( ):
    def lago_search(self):
        #调用浏览器驱动并传入url参数并最大化窗口
        driver = webdriver.Chrome()
        driver.get("https://www.lagou.com")
        driver.maximize_window()
        time.sleep(5)
        #关闭弹窗
        driver.find_element(By.ID, 'cboxClose').click()
        time.sleep(5)
        #输入搜索关键字并执行搜索
        driver.find_element(By.ID,"search_input").send_keys("阿里巴巴")
        driver.find_element(By.ID,"search_button").click()
        time.sleep(5)
        #断言
        assert_text=driver.find_element(By.XPATH,"//*[@id='jobsContainer']/div[2]/div[1]/div/div[2]/div[1]/h3/a")
        time.sleep(5)
        print(assert_text.text)
        assert assert_text.text == "阿里巴巴集团"


